<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>我要申诉</title>
    <link rel="stylesheet"  href="src/css/base.css?__version=9.4">
    <link rel="stylesheet"  href="src/css/pages.css?__version=9.4">
    <script type="text/javascript" src="src/js/jquery-1.10.1.min.js?__version=9.4"></script>
    <script type="text/javascript" src="src/js/rem.js?__version=9.4"></script>
    <script type="text/javascript" src="src/js/dropload.js?__version=9.4"></script>
    <script type="text/javascript" src="src/js/init.js?__version=9.4"></script>

	<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script src="/src/js/share.js?__version=9.4"></script>
    <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?8ed2efe5b24e14f351f4d88ba2eb3462";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
</head>
<body>
	<div class="init_content" style="display: none;">
        <header class="fixed_top"><a href="javascript:history.back(-1);" class="back"></a><span>我要申诉</span> <button class="appeal_submit" id="submit">提交</button></header>
        <div class="warp appeal_warp" id="htmlDataList">
            <div class="caption top">
                <div class="videoed clearfix">
                    <img class="cover" src="">
                    <div class="videoec_info">
                        <div class="title">视频证据</div>
                        <div class="info">已有游戏视频</div>
                        <img src="src/img/play.png">
                    </div>
                </div>
            </div>
            <div class="caption">
                <div class="complaint_title">申诉理由</div>
                <div class="complaint_list">
                    <ul id="list">
                    </ul>
                </div>
            </div>
    	</div>
	</div>
    <div class="complaint_box none">
        <div class="complaint_chat">
            <textarea class="complaint_msg" placeholder="请输入申诉其他原因"></textarea>
            <button class="msgsure">确定</button>
        </div>
    </div>
    <div class="complaint_alertmsg none">
        <div class="msg"></div>
    </div>
	<div class="init_loading">
        <img src="src/img/page_loading.gif?v=1">
    </div>
</body>
<script>

var play_Id=getQueryString('play_id');
complain();
function complain(){
    $.ajax({
        type:'get',
        url:api_url+'/OpenAPI/V1/User/complain',
        jsonp:'callback',
        dataType:'jsonp',
        success:function(res){
            console.log(res)
            var list=res.data;
            var html="";
            for(var i=0;i<list.length;i++){
                if(list[i]['complain_id']=="99"){
                    html+='<li class="other" data-val="'+list[i]['content']+'" data-id="'+list[i]['complain_id']+'" >'+list[i]['content']+'</li>';
                }else{
                    html+='<li data-val="'+list[i]['content']+'" data-id="'+list[i]['complain_id']+'">'+list[i]['content']+'</li>';
                }
            }
            $("#list").html(html)
        }
    })
}
var complainData={};
$(document).on("click",".appeal_warp .complaint_list li",function(){
    $(this).addClass("active").siblings().removeClass("active");
    complainData=$(this).data()
    if($(this).hasClass("other")){
        $(".complaint_box").removeClass("none");
        $(".complaint_msg").val("").focus();
    }
})
$(document).on("click",".msgsure",function(){
    $(".complaint_box").addClass("none");
    var val=$(".complaint_msg").val();
    if($.trim(val).length>0){
        $(".appeal_warp .complaint_list li.other").html(val);
        complainData.val=val;
    }
})
$(document).on("click",".complaint_box",function(e){
    var target=$(e.target);
    if(!target.is(".complaint_chat *")&&!target.is(".complaint_chat")){
        $(".complaint_box").addClass("none");
    }
})
$(document).on("click","#submit",function(e){
    console.log(complainData);
    if(complainData.val=="其他原因"){
        $(".complaint_alertmsg .msg").html("理由不能为空")
        $(".complaint_alertmsg").removeClass("none");
        return;
    }
    $.ajax({
        type:'post',
        url:api_url+'/OpenAPI/V1/User/complainPost',
        jsonp:'callback',
        dataType:'jsonp',
        data:{play_id:play_Id,complain_id:complainData.id,complain_values:complainData.val,token:token},
        success:function(res){
            console.log(res)
            if(res.code=="0"){
                $(".complaint_alertmsg .msg").html("提交成功")
                $(".complaint_alertmsg").removeClass("none");
            }else{
                $(".complaint_alertmsg .msg").html("提交失败")
                $(".complaint_alertmsg").removeClass("none");
            }
            setTimeout(function(){
                window.history.go(-1);
            },2000)
        }
    })
})
fetchData("/OpenAPI/V1/User/playList",{token:token,uid:cookieGet("uid"),page:1},function(data){
        console.log(data)
        var list=data.list;
        var html='';
        for(var i=0;i<list.length;i++){
            if(list[i]['game_id']==play_Id){
                $(".appeal_warp .videoed .cover").attr("src",list[i]['cover'])
            }
        }
    });
</script>
</html>